package br.com.array.android.ma.view.activity;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import br.com.array.android.ma.R;
import br.com.array.android.ma.model.Notificacao;

/**
 * Created by Leonardo Neves on 07/08/2014.
 */
public class DetalheNotificacaoActivity extends Activity implements View.OnClickListener{

    public static final String KEY_MODEL = "modelo";

    private TextView textViewTitulo;
    private TextView textViewDescricao;
    private TextView textViewData;
    private ImageView imageViewEnviarMSG;
    private Notificacao notificacao;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.detalhe_notificacao_activity);


        textViewTitulo = (TextView) findViewById(R.id.detalhe_notificacao_activity_tv_titulo);
        textViewDescricao = (TextView) findViewById(R.id.detalhe_notificacao_activity_tv_descricao);
        textViewData = (TextView) findViewById(R.id.detalhe_notificacao_activity_tv_data);
        imageViewEnviarMSG = (ImageView) findViewById(R.id.detalhe_notificacao_activity_iv_enviar);

        imageViewEnviarMSG.setOnClickListener(this);

        notificacao = (Notificacao) getIntent().getSerializableExtra(KEY_MODEL);
        if (notificacao != null){
            textViewTitulo.setText(notificacao.getTitulo());
            textViewDescricao.setText(notificacao.getDescricao());
            textViewData.setText(notificacao.getData());
        } else {
            notificacao = new Notificacao();
        }
    }

    @Override
    public void onClick(View v) {
        new AlertDialog.Builder(this)
                .setIcon(android.R.drawable.ic_dialog_email)
                .setTitle("Atenção")
                .setMessage("Você deseja reportar à equipe de suporte sobre esta ocorrência?")
                .setPositiveButton("Sim", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        Toast.makeText(DetalheNotificacaoActivity.this, "Mensagem enviada!", Toast.LENGTH_LONG).show();
                        finish();
                    }
                })
                .setNegativeButton("Não", null).create().show();
    }
}